﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class LivingsBoardUIForm : BaseUIForm, IEventListener
{
    private GameObject livingsItem;
    private GameObject LivingAllItems;
    private void Awake()
    {
        CurrentUIType.UIForms_Type = UIFormType.PopUp;  //弹出窗体
        LivingAllItems = GameObject.Find("UI/PopUp/LivingBoard/BackGround/AllItems").gameObject;
    }
    private void Start()
    {
        //EventNodeCore.GetInstance().AttachEventListener(EventDef.PickSomeThing, this);
    }
    public bool HandleEvent(int id, object para1, object param2)
    {
        Weapon weaponData = (Weapon)para1;
        if (id == EventDef.PickSomeThing)
        {

            livingsItem = Instantiate(Resources.Load(UIFormConst.LivingsBoartItem, typeof(GameObject)) as GameObject);
            livingsItem.transform.Find("Description").GetComponent<Text>().text = weaponData.Description;
            livingsItem.transform.Find("Icon").GetComponent<Image>().overrideSprite = Resources.Load(weaponData.Sprite, typeof(Sprite)) as Sprite;
            livingsItem.transform.parent = LivingAllItems.transform;
        }
        return false;
    }
    public int EventPriority()
    {
        return 0;
    }
}
